﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace aier.dataaccess.model
{
    [global::System.AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
    public sealed class XrmFieldMappingAttribute : Attribute
    {
        readonly string attributeName;
        readonly XrmAttributeType crmType;
        readonly bool allowEmpty;

        public XrmFieldMappingAttribute(string attributeName)
            : this(attributeName, XrmAttributeType.String, false)
        {

        }

        public XrmFieldMappingAttribute(string attributeName, XrmAttributeType crmType)
            : this(attributeName, crmType, false)
        {

        }

        public XrmFieldMappingAttribute(string attributeName, XrmAttributeType crmType, bool allowEmpty)
        {
            this.attributeName = attributeName;
            this.crmType = crmType;
            this.allowEmpty = allowEmpty;
        }

        public string AttributeName
        {
            get { return attributeName; }
        }

        public XrmAttributeType CrmType
        {
            get { return crmType; }
        }

        public bool AllowEmpty
        {
            get { return allowEmpty; }
        }

    }
}
